const Router = require('koa-router');
const { verifyLabel } = require('../middleware/label.middleware');
const { verifyAuth, verifyPermission } = require('../middleware/auth.middleware');
const { create, addLabel, removeLabel, remove, list } = require('../controller/label.controller');

const labelRouter = new Router({ prefix: "/label" });

// 创建一个标签
labelRouter.post("/", verifyAuth, create);
// 动态添加标签
labelRouter.post("/:momentId/add", verifyAuth, verifyLabel, verifyPermission, addLabel);
// 动态移除标签
labelRouter.post("/:momentId/remove", verifyAuth, verifyLabel, verifyPermission, removeLabel);
// 删除一个标签
labelRouter.delete("/:labelId", verifyAuth, verifyPermission, remove);
// 获取全部标签
labelRouter.get("/", verifyAuth, list);

module.exports = labelRouter;
